package com.example.domain;

import io.swagger.annotations.ApiModelProperty;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;

import com.fasterxml.jackson.annotation.JsonIgnore;

@Entity
@Table(name = "user")
public class User {
    @ApiModelProperty(value = "唯一编码", example = "1001", required = true,
        position = 1)
    @Id
    @GeneratedValue
    private Long id;
    @ApiModelProperty(value = "年龄", example = "20", required = true,
        position = 2)
    @Column
    private Integer age;
    @ApiModelProperty(value = "姓名", example = "李四", required = true,
        position = 3)
    @Column
    private String name;
    @Column(name = "create_time")
    private Date createTime;
    @Column(name = "update_time")
    private Date updateTime;
    @JsonIgnore 
    @NotFound(action = NotFoundAction.IGNORE)
    @ManyToOne
    @JoinColumn(name = "dorm_id")
    private Dorm dorm;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public int getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    /**
     * @return the dorm
     */
    public Dorm getDorm() {
        return dorm;
    }

    /**
     * @param dorm
     *            the dorm to set
     */
    public void setDorm(Dorm dorm) {
        this.dorm = dorm;
    }

}
